

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>36.2. MacOS — Access to Mac OS interpreter features &mdash; Python v2.7.8 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.7.8',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python v2.7.8 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python v2.7.8 documentation" href="../index.html" />
    <link rel="up" title="36. Mac OS X specific services" href="mac.html" />
    <link rel="next" title="36.3. macostools — Convenience routines for file manipulation" href="macostools.html" />
    <link rel="prev" title="36.1. ic — Access to the Mac OS X Internet Config" href="ic.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
    <script type="text/javascript" src="../_static/copybutton.js"></script>
    
 
    

  </head>
  <body>  
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="macostools.html" title="36.3. macostools — Convenience routines for file manipulation"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="ic.html" title="36.1. ic — Access to the Mac OS X Internet Config"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="http://www.python.org/">Python</a> &raquo;</li>
        <li>
          <a href="../index.html">Python v2.7.8 documentation</a> &raquo;
        </li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="mac.html" accesskey="U">36. Mac OS X specific services</a> &raquo;</li> 
      </ul>
    </div>    

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-MacOS">
<span id="macos-access-to-mac-os-interpreter-features"></span><h1>36.2. <a class="reference internal" href="#module-MacOS" title="MacOS: Access to Mac OS-specific interpreter features. (deprecated) (Mac)"><tt class="xref py py-mod docutils literal"><span class="pre">MacOS</span></tt></a> &#8212; Access to Mac OS interpreter features<a class="headerlink" href="#module-MacOS" title="Permalink to this headline">¶</a></h1>
<p><em>Platforms: </em>Mac</p>
<p>This module provides access to MacOS specific functionality in the Python
interpreter, such as how the interpreter eventloop functions and the like. Use
with care.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This module has been removed in Python 3.x.</p>
</div>
<p>Note the capitalization of the module name; this is a historical artifact.</p>
<dl class="data">
<dt id="MacOS.runtimemodel">
<tt class="descclassname">MacOS.</tt><tt class="descname">runtimemodel</tt><a class="headerlink" href="#MacOS.runtimemodel" title="Permalink to this definition">¶</a></dt>
<dd><p>Always <tt class="docutils literal"><span class="pre">'macho'</span></tt>, from Python 2.4 on. In earlier versions of Python the value
could also be <tt class="docutils literal"><span class="pre">'ppc'</span></tt> for the classic Mac OS 8 runtime model or <tt class="docutils literal"><span class="pre">'carbon'</span></tt>
for the Mac OS 9 runtime model.</p>
</dd></dl>

<dl class="data">
<dt id="MacOS.linkmodel">
<tt class="descclassname">MacOS.</tt><tt class="descname">linkmodel</tt><a class="headerlink" href="#MacOS.linkmodel" title="Permalink to this definition">¶</a></dt>
<dd><p>The way the interpreter has been linked. As extension modules may be
incompatible between linking models, packages could use this information to give
more decent error messages. The value is one of <tt class="docutils literal"><span class="pre">'static'</span></tt> for a statically
linked Python, <tt class="docutils literal"><span class="pre">'framework'</span></tt> for Python in a Mac OS X framework, <tt class="docutils literal"><span class="pre">'shared'</span></tt>
for Python in a standard Unix shared library. Older Pythons could also have the
value <tt class="docutils literal"><span class="pre">'cfm'</span></tt> for Mac OS 9-compatible Python.</p>
</dd></dl>

<dl class="exception">
<dt id="MacOS.Error">
<em class="property">exception </em><tt class="descclassname">MacOS.</tt><tt class="descname">Error</tt><a class="headerlink" href="#MacOS.Error" title="Permalink to this definition">¶</a></dt>
<dd><p id="index-0">This exception is raised on MacOS generated errors, either from functions in
this module or from other mac-specific modules like the toolbox interfaces. The
arguments are the integer error code (the <tt class="xref c c-data docutils literal"><span class="pre">OSErr</span></tt> value) and a textual
description of the error code. Symbolic names for all known error codes are
defined in the standard module <a class="reference internal" href="undoc.html#module-macerrors" title="macerrors: Constant definitions for many Mac OS error codes. (deprecated) (Mac)"><tt class="xref py py-mod docutils literal"><span class="pre">macerrors</span></tt></a>.</p>
</dd></dl>

<dl class="function">
<dt id="MacOS.GetErrorString">
<tt class="descclassname">MacOS.</tt><tt class="descname">GetErrorString</tt><big>(</big><em>errno</em><big>)</big><a class="headerlink" href="#MacOS.GetErrorString" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the textual description of MacOS error code <em>errno</em>.</p>
</dd></dl>

<dl class="function">
<dt id="MacOS.DebugStr">
<tt class="descclassname">MacOS.</tt><tt class="descname">DebugStr</tt><big>(</big><em>message</em><span class="optional">[</span>, <em>object</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#MacOS.DebugStr" title="Permalink to this definition">¶</a></dt>
<dd><p>On Mac OS X the string is simply printed to stderr (on older Mac OS systems more
elaborate functionality was available), but it provides a convenient location to
attach a breakpoint in a low-level debugger like <strong class="program">gdb</strong>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Not available in 64-bit mode.</p>
</div>
</dd></dl>

<dl class="function">
<dt id="MacOS.SysBeep">
<tt class="descclassname">MacOS.</tt><tt class="descname">SysBeep</tt><big>(</big><big>)</big><a class="headerlink" href="#MacOS.SysBeep" title="Permalink to this definition">¶</a></dt>
<dd><p>Ring the bell.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Not available in 64-bit mode.</p>
</div>
</dd></dl>

<dl class="function">
<dt id="MacOS.GetTicks">
<tt class="descclassname">MacOS.</tt><tt class="descname">GetTicks</tt><big>(</big><big>)</big><a class="headerlink" href="#MacOS.GetTicks" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the number of clock ticks (1/60th of a second) since system boot.</p>
</dd></dl>

<dl class="function">
<dt id="MacOS.GetCreatorAndType">
<tt class="descclassname">MacOS.</tt><tt class="descname">GetCreatorAndType</tt><big>(</big><em>file</em><big>)</big><a class="headerlink" href="#MacOS.GetCreatorAndType" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the file creator and file type as two four-character strings. The <em>file</em>
parameter can be a pathname or an <tt class="docutils literal"><span class="pre">FSSpec</span></tt> or  <tt class="docutils literal"><span class="pre">FSRef</span></tt> object.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">It is not possible to use an <tt class="docutils literal"><span class="pre">FSSpec</span></tt> in 64-bit mode.</p>
</div>
</dd></dl>

<dl class="function">
<dt id="MacOS.SetCreatorAndType">
<tt class="descclassname">MacOS.</tt><tt class="descname">SetCreatorAndType</tt><big>(</big><em>file</em>, <em>creator</em>, <em>type</em><big>)</big><a class="headerlink" href="#MacOS.SetCreatorAndType" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the file creator and file type. The <em>file</em> parameter can be a pathname or an
<tt class="docutils literal"><span class="pre">FSSpec</span></tt> or  <tt class="docutils literal"><span class="pre">FSRef</span></tt> object. <em>creator</em> and <em>type</em> must be four character
strings.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">It is not possible to use an <tt class="docutils literal"><span class="pre">FSSpec</span></tt> in 64-bit mode.</p>
</div>
</dd></dl>

<dl class="function">
<dt id="MacOS.openrf">
<tt class="descclassname">MacOS.</tt><tt class="descname">openrf</tt><big>(</big><em>name</em><span class="optional">[</span>, <em>mode</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#MacOS.openrf" title="Permalink to this definition">¶</a></dt>
<dd><p>Open the resource fork of a file. Arguments are the same as for the built-in
function <a class="reference internal" href="functions.html#open" title="open"><tt class="xref py py-func docutils literal"><span class="pre">open()</span></tt></a>. The object returned has file-like semantics, but it is
not a Python file object, so there may be subtle differences.</p>
</dd></dl>

<dl class="function">
<dt id="MacOS.WMAvailable">
<tt class="descclassname">MacOS.</tt><tt class="descname">WMAvailable</tt><big>(</big><big>)</big><a class="headerlink" href="#MacOS.WMAvailable" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks whether the current process has access to the window manager. The method
will return <tt class="xref docutils literal"><span class="pre">False</span></tt> if the window manager is not available, for instance when
running on Mac OS X Server or when logged in via ssh, or when the current
interpreter is not running from a fullblown application bundle. A script runs
from an application bundle either when it has been started with
<strong class="program">pythonw</strong> instead of <strong class="program">python</strong> or when running  as an applet.</p>
</dd></dl>

<dl class="function">
<dt id="MacOS.splash">
<tt class="descclassname">MacOS.</tt><tt class="descname">splash</tt><big>(</big><span class="optional">[</span><em>resourceid</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#MacOS.splash" title="Permalink to this definition">¶</a></dt>
<dd><p>Opens a splash screen by resource id. Use resourceid <tt class="docutils literal"><span class="pre">0</span></tt> to close
the splash screen.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Not available in 64-bit mode.</p>
</div>
</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="ic.html"
                        title="previous chapter">36.1. <tt class="docutils literal docutils literal docutils literal"><span class="pre">ic</span></tt> &#8212; Access to the Mac OS X Internet Config</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="macostools.html"
                        title="next chapter">36.3. <tt class="docutils literal docutils literal"><span class="pre">macostools</span></tt> &#8212; Convenience routines for file manipulation</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
  <li><a href="../bugs.html">Report a Bug</a></li>
  <li><a href="../_sources/library/macos.txt"
         rel="nofollow">Show Source</a></li>
</ul>

<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>  
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="macostools.html" title="36.3. macostools — Convenience routines for file manipulation"
             >next</a> |</li>
        <li class="right" >
          <a href="ic.html" title="36.1. ic — Access to the Mac OS X Internet Config"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="http://www.python.org/">Python</a> &raquo;</li>
        <li>
          <a href="../index.html">Python v2.7.8 documentation</a> &raquo;
        </li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="mac.html" >36. Mac OS X specific services</a> &raquo;</li> 
      </ul>
    </div>  
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2014, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.
    <a href="http://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Jun 29, 2014.
    <a href="../bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>

  </body>
</html>